package com.hermes.action.subject;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.hermes.biz.common.model.item.CategorysDO;
import com.hermes.biz.common.model.item.ItemDO;
import com.hermes.biz.common.model.item.ItemPublicDO;
import com.hermes.biz.common.model.item.TagDO;
import com.hermes.biz.common.model.result.ItemResultDO;
import com.hermes.biz.common.model.user.QuestionDO;
import com.hermes.biz.common.model.user.UserPublicDO;
import com.hermes.biz.common.util.string.StringUtil;
import com.hermes.biz.dao.item.CategorysDAO;
import com.hermes.biz.dao.item.TagsDAO;
import com.hermes.biz.service.item.ItemService;
import com.hermes.common.action.BaseAction;
import com.hermes.common.util.LoginHelperUtil;
import com.hermes.common.util.ParameterParserUtil;

public class DetailDisplay1 extends BaseAction{

	/**
	 *
	*/
	public CategorysDAO categorysDAO;
	
	public TagsDAO tagsDAO;
	
	private static final long serialVersionUID = -5246087099224495968L;
			
	private Logger log = Logger.getLogger(DetailDisplay.class);
			
	private ItemService itemService;
			
	private ItemPublicDO result;
		
	public String username="";
	
	public String userAddr="";
	
	public String userAddrCity="";
	
	public UserPublicDO userPublicDO;
	
	public List<String> cates;
	
	public List<QuestionDO> questionDOs;

	public UserPublicDO getUserPublicDO() {
		return userPublicDO;
	}

	public void setUserPublicDO(UserPublicDO userPublicDO) {
		this.userPublicDO = userPublicDO;
	}

	public boolean isLogin = false;
			
	public long userid;

	public String url;
	
	public String[] cateids;
	
	public List<String> tagids;
	
	public List<String> itemImages;
	
	public String userHeadPicUrl;
	
	public String userDesc;
	
	public String itemTitle;
	
	@Override
	public String execute() {
			//test detail1 - the new detail . mock return success.
		itemTitle = "世界最好的蜂蜜 麦卢卡蜂蜜 new zealand -- Manuka Honey ";
		itemImages = new ArrayList<String>();
		itemImages.add("http://img03.taobaocdn.com/imgextra/i3/673491580/T2dl2dXJFaXXXXXXXX_!!673491580.jpg_.webp");
		itemImages.add("http://img03.taobaocdn.com/imgextra/i3/673491580/T2coGtXs8aXXXXXXXX_!!673491580.jpg_.webp");
		itemImages.add("http://img02.taobaocdn.com/imgextra/i2/512998550/T2QbZxXkBbXXXXXXXX-512998550.jpg_q90.jpg_.webp");
		itemImages.add("http://img02.taobaocdn.com/imgextra/i2/1749104770/T2mQnrXp8XXXXXXXXX-1749104770.jpg_.webp");
		//user info
		userHeadPicUrl = "http://tp4.sinaimg.cn/3070693303/180/40052940724/0";
		username="我爱new zealand.";
		userAddr = "middle zone park.";
		userAddrCity="Auckland, New Zealand";
		userDesc = "I am a programmer, I wanted to emigrate to New Zealand. Breathe fresh air, feel the nature. For now, perhaps the dream is still relatively far away, but I will work hard to achieve it. I hope my wife and I can work together. ";
		//fetch questions
		questionDOs = new ArrayList<QuestionDO>();
		QuestionDO questionDO = new QuestionDO();
		questionDO.setQuestionTitle("经常饮茶对身体有什么好处？");
		questionDO.setQuestionContent("提神醒脑，使人精神振奋，增强记忆力,兴奋中枢神经，增加运动能力,刺激胃液分泌，帮助消化，增进食欲，消除口臭,保养肌肤，分解中性脂肪，达到减肥美容效果……");
		QuestionDO questionDO1 = new QuestionDO();
		questionDO1.setQuestionTitle("经常饮茶有坏处吗？");
		questionDO1.setQuestionContent("不宜餐前睡前喝茶﹐宜餐后餐间饮茶：餐前喝茶容易刺激肠胃(尤其是绿茶)﹐睡前喝茶则容易影响睡眠品质,茶水不宜过浓﹐也不宜置放太久,服用药物时﹐不可以茶水配服﹐会影响药效.");
		questionDOs.add(questionDO);
		questionDOs.add(questionDO1);
		return SUCCESS;
			}
		
			public ItemService getItemService() {
				return itemService;
			}
		
			public void setItemService(ItemService itemService) {
				this.itemService = itemService;
			}

			public ItemPublicDO getResult() {
				return result;
			}

			public void setResult(ItemPublicDO result) {
				this.result = result;
			}
			public String getUsername() {
				return username;
			}

			public void setUsername(String username) {
				this.username = username;
			}

			public boolean isLogin() {
				return isLogin;
			}

			public void setLogin(boolean isLogin) {
				this.isLogin = isLogin;
			}

			public CategorysDAO getCategorysDAO() {
				return categorysDAO;
			}

			public void setCategorysDAO(CategorysDAO categorysDAO) {
				this.categorysDAO = categorysDAO;
			}

			public TagsDAO getTagsDAO() {
				return tagsDAO;
			}

			public void setTagsDAO(TagsDAO tagsDAO) {
				this.tagsDAO = tagsDAO;
			}
			public long getUserid() {
				return userid;
			}

			public void setUserid(long userid) {
				this.userid = userid;
			}

			public String getUrl() {
				return url;
			}

			public void setUrl(String url) {
				this.url = url;
			}
}
